import 'src/global.css';

import { useEffect } from 'react';

import Fab from '@mui/material/Fab';

import { Router } from 'src/routes/sections';

import { useScrollToTop } from 'src/hooks/use-scroll-to-top';

import { ThemeProvider } from 'src/theme/theme-provider';

import { Iconify } from 'src/components/iconify';

import { useRouter } from './routes/hooks';

// ----------------------------------------------------------------------

export default function App() {
  useScrollToTop();

    const router = useRouter();
    const  isAuthenticated = localStorage.getItem('isAuthenticated')==='true'
    useEffect(() => {
        if (!isAuthenticated && router.currentPath !== '/up-passwd'){
            router.push('/sign-in')
        }
    }, [isAuthenticated, router]);


  return (
    <ThemeProvider>
      <Router />
    </ThemeProvider>
  );
}
